<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions">
    <h:head>
        <style type="text/css">
            .pic{
                margin-bottom: -4px;
                margin-right: -2px;
                border:none;
            }
            .ecol1 { vertical-align: top; padding-right : 25px }
            .ecol2 { vertical-align: top; border-left: #ACBECE 1px solid; padding-left : 10px }
            .rich-calendar-tool-btn{
                font-family: Arial, Verdana;
            }
        </style>
        <link href="./css/spreadsheet.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body>
        <h:form id="customerrfq">
            <rich:panel header=" 单据审批" style="width:700px">
                <h:commandLink  action="#{checkBean.reback}" >
                    <h:graphicImage value="/images/return.gif" style="border:0" />
                </h:commandLink><br />
                <rich:panel id="selectid" >
                    <h:panelGrid columns="1">
                        <c:if test="true">
                            <a4j:commandLink value="开始节点" style="background:url(images/BlueExplorer.jpg);"/>
                            <h:graphicImage value="images/dot2.gif" styleClass="pic" />
                        </c:if>
                        <c:forEach var="it" items="#{checkBean.checknodes}">
                            <a4j:commandLink  value="#{it.level}  级审批" action="#{checkBean.actionForCheck2}" style="background:url(images/BlueExplorer.jpg);"
                                              oncomplete="#{rich:component('detail')}.show()" render="detailpanel,queryCondition">
                                <f:setPropertyActionListener value="#{it.nodes}"
                                                             target="#{checkBean.currennodes}" />
                                <f:setPropertyActionListener value="#{it}"
                                                             target="#{checkBean.currennode}" />
                            </a4j:commandLink>
                            <h:graphicImage value="images/dot3.gif" styleClass="pic" rendered="#{fn:contains(it.isCheck,'0')}" />
                            <h:graphicImage value="images/dot2.gif" styleClass="pic" rendered="#{fn:contains(it.isCheck,'1')}" />
                        </c:forEach>
                        <c:if test="true">
                            <a4j:commandLink value="结束节点" style="background:url(images/BlueExplorer.jpg);" >
                            </a4j:commandLink>
                        </c:if>
                    </h:panelGrid>
                </rich:panel>

                <h:outputLabel value="警告：" /><br />

                <h:outputLabel id="errmessage" value="#{queryBean.err.errtip}" style="color:red" />
            </rich:panel>
        </h:form>
        <rich:popupPanel id="detail" width="130" height="150">
            <f:facet name="header">本节点审批人</f:facet>
            <f:facet name="controls">
                <h:panelGroup>
                    <h:outputLink onclick="#{rich:component('detail')}.hide();return false">关闭</h:outputLink>
                </h:panelGroup>
            </f:facet>
            <h:form>
                <h:panelGrid  id="detailpanel"  columnClasses="col1,col2">
                    <rich:panel   style="border:0px">
                        <rich:dataTable value="#{checkBean.currennodes}" var="it">
                            <h:column>
                                #{it.name}(#{it.id})
                            </h:column>
                        </rich:dataTable>
                        <br />
                        <a4j:commandLink style="float:right" value="审批"
                                         oncomplete="#{rich:component('panel')}.show();#{rich:component('detail')}.hide()"
                                         render="check1">
                        </a4j:commandLink>
                    </rich:panel>
                </h:panelGrid>
            </h:form>
        </rich:popupPanel>
        <rich:popupPanel id="panel" width="400" height="420">
            <f:facet name="header">
                <h:panelGroup>
                    <h:outputText value="审批"></h:outputText>
                </h:panelGroup>
            </f:facet>
            <f:facet name="controls">
                <h:form>
                    <h:panelGroup>
                        <h:outputLink onclick="#{rich:component('panel')}.hide();return false">关闭</h:outputLink>
                    </h:panelGroup>
                </h:form>
            </f:facet>
            <h:form id="queryCondition">
                <rich:panel>
                    <h:panelGrid id="check" columns="1" width="300px">
                        <h:outputLabel value="是否同意：" />
                        <h:selectOneRadio value="#{checkBean.currennode.isConfirm}">
                            <f:selectItem itemValue="0" itemLabel="不同意" />
                            <f:selectItem itemValue="1" itemLabel="同意" />
                        </h:selectOneRadio>
                    </h:panelGrid>
                </rich:panel>
                <rich:panel>
                    <h:outputLabel value="审批意见：" />
                    <h:inputTextarea cols="60" rows="4"  value="#{checkBean.currennode.content}" />
                    <br />
                </rich:panel>
                <rich:panel>
                    <h:panelGrid id="check1" columns="2" width="190px">
                        <h:outputLabel value="审批人：" /><h:outputLabel  value="#{checkBean.currennode.checker.cpsn_name}" />
                        <h:outputLabel value="审批日期：" /><h:outputLabel id="checkdate" value="#{checkBean.currennode.checkdate}">
                            <f:convertDateTime timeZone="GMT+8" pattern="yyyy-MM-dd HH:mm" dateStyle="medium"/>
                        </h:outputLabel>
                        <a4j:commandButton value="审批" action="#{checkBean.check}" rendered="${fn:contains(checkBean.currennode.isCheck,'0')}"
                                           style="float:left" render="checkdate,selectid,check1,err2"  />
                        <a4j:commandButton value="弃审" action="#{checkBean.cancelcheck}"  render="checkdate,selectid,check1,err2"  />
                    </h:panelGrid>
                </rich:panel>
                <h:outputLabel value="警告：" /><br />
                <h:outputLabel id="err2" value="#{queryBean.err.errtip}" style="color:red" />
            </h:form>
        </rich:popupPanel>
    </h:body>
</ui:composition>
